<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>竖行文字居中</title>
    <style>
        .wrap {
            width: 400px;
            margin: 0 auto;
        }
        h1 {
            text-align: center;
            font-size: 24px;
            color: #333;
        }
        .css-demo {
            display: flex;
            justify-content: center;
        }
        .css-demo-item {
            margin: 20px;
        }
        .vertical-text-center {
            width: 1em;
            padding: 5px;
            height: 200px;
            text-align: center;
            border: 1px solid #ccc;
        }
        .demo01 {
            display: table-cell;
            vertical-align: middle;            
        }
        .demo02 {
            display: flex;
            align-items: center;
        }
    </style>
</head>
<body class="wrap">
    <h1>竖行文字居中</h1>
    <div class="css-demo">
        <!-- 方法一 -->
        <div class="css-demo-item">
            <div class="vertical-text-center demo01">
                少即是多
            </div>
        </div>
        <!-- 方法二 -->
        <div class="css-demo-item">
            <div class="vertical-text-center demo02">
                少即是多
            </div>
        </div>  
    </div>
    <pre>
        说明：
           1. 设置`width: 1em`保证一行只包含一个文字
           2. 文字居中实质就是多行文本居中
    </pre>
</body>
</html>